package main.war.city.building;

import org.bukkit.Location;

public class BuildingTerritory {
	private Loc A;
	private Loc B;
	public BuildingTerritory(Loc A,Loc B){
		this.A = new Loc(A.getX()>B.getX()?A.getX():B.getX(),A.getY()>B.getY()?A.getY():B.getY(),A.getZ()>B.getZ()?A.getZ():B.getZ());
		this.B = new Loc(A.getX()<B.getX()?A.getX():B.getX(),A.getY()<B.getY()?A.getY():B.getY(),A.getZ()<B.getZ()?A.getZ():B.getZ());
	}
	public boolean inBuilding(Loc l){
		return inBuilding(l.getX(),l.getY(),l.getZ());
	}
	public boolean inBuilding(Location l){
		return inBuilding(l.getBlockX(),l.getBlockY(),l.getBlockZ());
	}
	public boolean inBuilding(int x,int y,int z){
		if(A.getX()>=x&&B.getX()<=x&&A.getY()>=y&&B.getY()<=y&&A.getZ()>=z&&B.getZ()<=z)
			return true;
		return false;
	}
	public Loc getLocA() {
		return A;
	}
	public Loc getLocB() {
		return B;
	}
}
